clear
rng default
tab=cell(22,15);
%% DGP1
%%%%%%%% Row 1: True and Logit values %%%%%%%%
%%% Load
fp0='.../DGP1/[1]'; %complete with the correct path
[U_11_CS, U_12_CS, U_21_CS, U_22_CS,...
 V_11_CS, V_12_CS, V_21_CS, V_22_CS,...
 Phi_11_CS, Phi_12_CS, Phi_21_CS, Phi_22_CS,...
 D_CS, AvU21_CS, AvV21_CS]=load_function_CS(fp0);

%%% Fill
tab(1,:)=fill_function(U_11_CS,U_12_CS,U_21_CS, U_22_CS,...
                       V_11_CS,V_12_CS,V_21_CS, V_22_CS,...
                       Phi_11_CS, Phi_12_CS, Phi_21_CS, Phi_22_CS, ...
                       D_CS, AvU21_CS, AvV21_CS);



%%%%%%%% Row 2: Independence %%%%%%%%
%%% Load
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(2,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);



%%%%%%%% Row 3: Independence, symmetric marginals, and identical marginals %%%%%%%%
%%% Load
fp0='.../DGP1/[2]';

[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(3,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);
                       
                       
%%%%%%%% Row 4: Marginals symmetric at 0 %%%%%%%%
%%% Load
fp0='.../DGP1/[3]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(4,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);
                       
%%%%%%%% Row 5: Marginals symmetric at 0 and identical %%%%%%%%
%%% Load
fp0='.../DGP1/[4]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(5,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);



%%%%%%%% Row 6: identical bivariate %%%%%%%%
fp0='.../DGP1/[5]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(6,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);

%%%%%%%% Row 7: Marginals symmetric at 0 and identical, identical bivariate %%%%%%%%
fp0='.../DGP1/[6]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(7,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);




%% DGP2
%%%%%%%% Row 8: True values, under independence %%%%%%%%
%%% Load
fp0='.../DGP2/[1]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function_true_indep(fp0);

%%% Fill
tab(8,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);

                   
%%%%%%%% Row 9: Logit values %%%%%%%%
%%% Load
[U_11_CS, U_12_CS, U_21_CS, U_22_CS,...
 V_11_CS, V_12_CS, V_21_CS, V_22_CS,...
 Phi_11_CS, Phi_12_CS, Phi_21_CS, Phi_22_CS,...
 D_CS, AvU21_CS, AvV21_CS]=load_function_CS(fp0);

%%% Fill
tab(9,:)=fill_function(U_11_CS,U_12_CS,U_21_CS, U_22_CS,...
                       V_11_CS,V_12_CS,V_21_CS, V_22_CS,...
                       Phi_11_CS, Phi_12_CS, Phi_21_CS, Phi_22_CS, ...
                       D_CS, AvU21_CS, AvV21_CS);                   

                   
%%%%%%%% Row 10: Independence %%%%%%%%
%%% Load
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(10,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);



%%%%%%%% Row 11: Independence, symmetric marginals, and identical marginals %%%%%%%%
%%% Load
fp0='.../DGP2/[2]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(11,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);

%%%%%%%% Row 12: True values, without independence %%%%%%%%
%%% Load
fp0='.../DGP2/[3]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function_true(fp0);

%%% Fill
tab(12,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);    

                                      
%%%%%%%% Row 13: Marginals symmetric at 0 %%%%%%%%
%%% Load
fp0='.../DGP2/[3]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(13,:)=fill_function(U_11,U_12,U_21, U_22,...
                        V_11,V_12,V_21, V_22,...
                        Phi_11, Phi_12, Phi_21, Phi_22, ...
                        D, AvU21, AvV21);
                       
%%%%%%%% Row 14: Marginals symmetric at 0 and identical %%%%%%%%
%%% Load
fp0='.../DGP2/[4]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(14,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);


%%%%%%%% Row 15: identical bivariate %%%%%%%%
fp0='.../DGP2/[5]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(15,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);

%%%%%%%% Row 16: Marginals symmetric at 0 and identical, identical bivariate %%%%%%%%
fp0='.../DGP2/[6]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(16,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);

 
                  

%% DGP3
%%%%%%%% Row 17: True values %%%%%%%%
%%% Load
fp0='.../DGP3/[3]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function_true(fp0);

%%% Fill
tab(17,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);    
                   
                   
%%%%%%%% Row 18: Logit values %%%%%%%%
%%% Load
[U_11_CS, U_12_CS, U_21_CS, U_22_CS,...
 V_11_CS, V_12_CS, V_21_CS, V_22_CS,...
 Phi_11_CS, Phi_12_CS, Phi_21_CS, Phi_22_CS,...
 D_CS, AvU21_CS, AvV21_CS]=load_function_CS(fp0);

%%% Fill
tab(18,:)=fill_function(U_11_CS,U_12_CS,U_21_CS, U_22_CS,...
                       V_11_CS,V_12_CS,V_21_CS, V_22_CS,...
                       Phi_11_CS, Phi_12_CS, Phi_21_CS, Phi_22_CS, ...
                       D_CS, AvU21_CS, AvV21_CS);                   

                
%%%%%%%% Row 19: Marginals symmetric at 0 %%%%%%%%
%%% Load
fp0='.../DGP3/[3]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(19,:)=fill_function(U_11,U_12,U_21, U_22,...
                        V_11,V_12,V_21, V_22,...
                        Phi_11, Phi_12, Phi_21, Phi_22, ...
                        D, AvU21, AvV21);
                       
%%%%%%%% Row 20: Marginals symmetric at 0 and identical %%%%%%%%
%%% Load
fp0='.../DGP3/[4]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(20,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);


%%%%%%%% Row 21: identical bivariate %%%%%%%%
fp0='.../DGP3/[5]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(21,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);

%%%%%%%% Row 22: Marginals symmetric at 0 and identical, identical bivariate %%%%%%%%
fp0='.../DGP3/[6]';
[U_11, U_12, U_21, U_22,...
 V_11, V_12, V_21, V_22,...
 Phi_11, Phi_12, Phi_21, Phi_22,...
 D, AvU21, AvV21]=load_function(fp0);
%%% Fill
tab(22,:)=fill_function(U_11,U_12,U_21, U_22,...
                       V_11,V_12,V_21, V_22,...
                       Phi_11, Phi_12, Phi_21, Phi_22, ...
                       D, AvU21, AvV21);



%% Generate Latex table
n_digits=2;
for i=1:22
    for j=1:15
        tab{i,j}= round(tab{i,j},n_digits);
        tab{i,j}=mat2str(tab{i,j});
    end
end
matrix2latex(tab,'tab1.tex','alignment', 'c', 'format', '%1.1f', 'size', 'tiny');





